package buco.core.api;

import java.util.*;

public class BundleIntegrityReport implements IntegrityReport {

	private Bundle bundle; 
	private List<SemanticMessage> messages;
			
	public BundleIntegrityReport(Bundle bundle) {
		this.bundle = bundle;
		this.messages = new ArrayList<SemanticMessage>(); 
	}
	
	public BundleIntegrityReport() {	
		this.messages = new ArrayList<SemanticMessage>(); 
	}
	
	
	public List<SemanticMessage> getMessages() { 
		return this.messages; 
	}
	
	@Override
	public void warn(String warning) {
		addMessage(warning, SemanticMessageType.WARNING);
	}

	@Override
	public void info(String info) {
		addMessage(info, SemanticMessageType.INFO);		
	}

	@Override
	public void error(String error) {
		addMessage(error, SemanticMessageType.ERROR);		
	}
		
	private void addMessage(String message, SemanticMessageType type) {
		SemanticMessage semMessage = new SemanticMessage(message, type, this.bundle); 
		messages.add(semMessage);
	}
	
	public void setBundle(Bundle bundle) { 
		this.bundle = bundle; 
	}
}
